package view
{
	import com.bit101.components.ImageEmbedButton;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	public class AlertShow extends Sprite
	{
		[Embed(source="assets/btns/AlertBg.png")]
		private var bgCls:Class;
		[Embed(source="assets/btns/BtnBg.png")]
		private var btnCls:Class;
		private var mainTxt:TextField;
		private var sureBtn:ImageEmbedButton;
		private var cancelBtn:ImageEmbedButton;
		private var _fun:Function;
		public function AlertShow()
		{
			init();
		}
		private function init():void{
			var bgbitmap:Bitmap = new bgCls();
			this.addChild(bgbitmap);
			
			mainTxt = new TextField;
			mainTxt.width = 280;
			mainTxt.height = 70;
			mainTxt.wordWrap = true;
			mainTxt.multiline = true;
			mainTxt.x = 10;
			mainTxt.y = 65;
			this.addChild(mainTxt);
			
			sureBtn = new ImageEmbedButton(this,20,120,btnCls,sureClick);
			sureBtn.setLabel("确定",'#656565');
			
			cancelBtn = new ImageEmbedButton(this,150,120,btnCls,cancelClick);
			cancelBtn.setLabel("取消",'#006699');
		}
		public function setInfo(str:String,fun:Function):void{
			this._fun = fun;
			mainTxt.htmlText = "<p align='center'><font face='微软雅黑' color='#656565' size='17'><b>"+ str +"</b></font></p>"
		}
		private function sureClick(evnet:MouseEvent):void{
			_fun();
			this.parent.removeChild(this);
		}
		private function cancelClick(evnet:MouseEvent):void{
			this.parent.removeChild(this);
		}
		
		
	}
}